package com.example.controller;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.TypeReference;
import com.example.base.Action.BaseAction;
import com.example.base.ResultVO;
import com.example.entity.Sysdata;
import com.example.repository.SysDataRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * Created by Administrator on 2019/7/8.
 */
@RestController
@RequestMapping(value = "sysDataAction")
public class SysDataAction extends BaseAction{

    @Autowired
    private SysDataRepository sysDataRepository;

    @RequestMapping("/getSysdataByCode")
    public ResultVO getSysdataByCode(String code){

        Sysdata sysdata=sysDataRepository.findByCode(code);
        Map<String, String> map = JSON.parseObject(sysdata.getSysValue(), new TypeReference<Map<String, String>>() {
        });
        return success(map);
    }

}
